package com.wh1200.xmlless.test.form

import com.wh1200.mybatis.xmlless.annotations.ChooseCriteria
import com.wh1200.mybatis.xmlless.annotations.TestCriteria
import com.wh1200.mybatis.xmlless.annotations.criteria.Criteria
import com.wh1200.mybatis.xmlless.enums.Operations
import java.util.*

class StudentQueryForm(
    @Criteria(Operations.Eq)
    var age: Int? = null,
    @Criteria(Operations.Like)
    var name: String? = null,
    var start: Date? = null,
    var end: Date? = null,
    @Criteria(Operations.Like, ["userName"])
    var keywords: String? = null
) {

  @TestCriteria(
      ifExpression = "== 2 and currentUserId != null",
      sqlExpression = "updateUserId = currentUserId"
  )
  @TestCriteria(
      ifExpression = ">= 5 and currentUserId != null",
      sqlExpression = "createUserId = currentUserId",
  )
  @TestCriteria(
      ifExpression = "<= 12 and currentUserId != null",
      sqlExpression = "userId = currentUserId",
  )
  var type: Int? = null

  var currentUserId: Int? = null

  var startDate: Date? = null
  var endDate: Date? = null

}
